<?php
App::uses('AppModel', 'Model');
/**
 * Skill Model
 *
 * @property Character $Character
 */
class Skill extends AppModel {
/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'name';
/**
 * Validation rules
 *
 * @var array
 */
// TODO check all validation rules
	public $validate = array(
		'cost' => array(
			'naturalNumber' => array(
				'rule' => array('naturalNumber'),
				'message' => 'Cost (XP) of skill can only contain numbers',
			),
		),
		'weight' => array(
			'naturalNumber' => array(
				'rule' => array('naturalNumber'),
				'message' => 'Weight (display order) of Skills can only contain numbers',
			),
		),
		'name' => array(
			'notEmpty' => array(
				'rule' => array('notempty'),
				'message' => 'All skills must have a name',
			),
		),
		'print_name' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'All skills must have a name for printing',
			),
		),
		'description' => array(),
		'deleted' => array(
			'boolean' => array(
				'rule' => array('boolean'),
				'message' => 'You should not be seeing this message. Deleted should be true or false.',
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasAndBelongsToMany associations
 *
 * @var array
 */
	public $hasAndBelongsToMany = array(
		'Character' => array(
			'className' => 'Character',
			'joinTable' => 'characters_skills',
			'foreignKey' => 'skill_id',
			'associationForeignKey' => 'character_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		)
	);

}
